Reputation: 23
import random
device = input("What device do you have? Phone or PC(laptop included). If other
please specify ").upper()
make = ("")
model= ("")
verison = ("")
memory = ("")
if device == ("PHONE"):
make = input ("what make of phone do you have? Iphone or Samsung or other").upper()
if make == ("IPHONE"):
model == input("What model is your iPhone 6 or 7. If other plese spectify")
if device != ("PHONE") or ("PHONE") or (""):
make =input("what make is your " + str(device)).upper()
model = input("whats model is your " + str(device)).upper()
verison = input("what verison is your " + str(device)).upper()
memory = int(input("How much memory is in your " + str(device)))
print(make, model, verison, memory,"GB")
print(casenumber)
f = open('technician.txt','a')
f.write("**CASE NUMBER:{}** ** DEVICE: {}** **MAKE OF DEVICE: {}** **MODEL OF DEVICE: {} **".format(casenumber,device,make,model,verison,memory))
f.write("/n")
f.close()
What I want for this to do is to write a on a separate line each time the program is finished. But /n does not work. I ran the program twice and all it does is write on the same line in the text file:
CASE NUMBER:574927542749031461928599801595193290973875978 ** DEVICE: TABEL** MAKE OF DEVICE: APPLE MODEL OF DEVICE: IPAD **/nCASE NUMBER:207884437699822095837989343019189844675528960** ** DEVICE: TABLET** MAKE OF DEVICE: APPLE **MODEL OF DEVICE: 2 **/n
All this is on the same line. Please help
Many Thanks,
Rory Eastham
Upvotes: 2
Views: 1614
Reputation: 294
The newline character is \n
, as opposed to the /n
used in your program. Updating your code with this should fix the issue you're describing.
Upvotes: 1