In a python script, how can I save the contents of a string to file, and the file is in current directory? i.e the same directory as the test.py script file
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want the path to the currently executing file (and not the working directory) use the
variable. You should note that this is the current file being run. So if you use it in an imported module, you’ll get the path to the module, etc..