Python Forum
Saving a file to a specific location
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Saving a file to a specific location
#1
Hi,

Im using this code to create a file with the username as the title and the password inside the file.

user_details = open(new_username_1 + ".txt","w") #creates a new file called "username".txt
user_details.write(new_password_1) #writes in the file what the users password is
user_details.close() #saves and closes the file
how what I get this to save to a specific folder that I have created

atm it saves in:

E:\Work\School\Computer Science\Python\Code

I want it to save in:

E:\Work\School\Computer Science\Python\Code\User Info

thanks
Reply


Messages In This Thread
Saving a file to a specific location - by finndude - Apr-23-2020, 11:39 AM
RE: Saving a file to a specific location - by buran - Apr-23-2020, 12:24 PM
RE: Saving a file to a specific location - by buran - Apr-23-2020, 12:43 PM
RE: Saving a file to a specific location - by buran - Apr-23-2020, 02:54 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Extracting specific file from an archive tester_V 4 555 Jan-29-2024, 06:41 PM
Last Post: tester_V
  Reading Specific Rows In a CSV File finndude 3 1,015 Dec-13-2022, 03:19 PM
Last Post: finndude
  Saving the times a script is run to a file or ... 3Pinter 7 1,446 Oct-19-2022, 05:38 PM
Last Post: 3Pinter
  Code Assistance needed in saving the file MithunT 0 835 Oct-09-2022, 03:50 PM
Last Post: MithunT
  Changing file location azizrasul 6 1,335 Sep-28-2022, 01:01 AM
Last Post: azizrasul
  Saving the print result in a text file Calli 8 1,887 Sep-25-2022, 06:38 PM
Last Post: snippsat
  How to extract specific data from .SRC (note pad file) Shinny_Shin 2 1,295 Jul-27-2022, 12:31 PM
Last Post: Larz60+
  Extracting Specific Lines from text file based on content. jokerfmj 8 3,103 Mar-28-2022, 03:38 PM
Last Post: snippsat
  Trying to determine attachment file type before saving off.. cubangt 1 2,191 Feb-23-2022, 07:45 PM
Last Post: cubangt
  Showing and saving the output of a python file run through bash Rim 3 2,513 Oct-06-2021, 10:48 AM
Last Post: gerpark

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020