473,322 Members | 1,352 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

write array into txt python

hello , i am waay new to python and programming.I'm trying to write program that stores username and password in txt but I don't seem to get what my problem is.

userName=str(raw_input ("Username :"))
passWord=str(raw_input("password : "))

stuData={}


stuData[userName ]=[passWord]
print stuData

f=open("student.txt","a")
f=write(stuData)
f=close()
May 5 '17 #1
1 1392
dwblas
626 Expert 512MB
Expand|Select|Wrap|Line Numbers
  1. f=write(stuData)
  2. f=close() 
are not valid Python statements, see https://www.tutorialspoint.com/pytho...n_files_io.htm
You can only write text to a text file, not a dictionary, so one way is to write the user name, then the password separately, using a \n (newline) as deliminator.
May 5 '17 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Bahaa Hany | last post by:
that the code i wrote FileStream w = new FileStream("d:\\HufmanCompression.txt",FileMode.Create); BinaryWriter writer = new BinaryWriter(w); for (i = 0; i <...
0
by: atulsharma84 | last post by:
i want to write a python script for a device NGX-5500 whose vendor is telllabs i hv to write python file like some other device file i m giving u example here below import java.lang as lang...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.