Login Register






My First Program Help! filter_list
Author
Message
My First Program Help! #1
So hi i was just wondering if its possible as i want to make a program where if the Input from the user was A then the screen clears and you can put whatever you want in it and save it this is what i have so far


#My random tool
Code:
print " " print "Welcome Nerd\n" def login(): usr = raw_input("Username: ") passw = raw_input("Password: ") if usr == "slither" and passw == "test": print "Success! You Have Logged In!" else: print "Login Failed Please Try Again!" login() print "" print "Type --help For Commands" print "" def whatNext(): next = raw_input("slither> ") if next == "--help": print " Use Can Use These Commands\n A For Inserting Text\n B For Inserting Files\n And C For Updates" elif next == "A": print "Need Help here!" # i dont know what to do next! whatNext()


thanks in advanced!

Reply

RE: My First Program Help! #2
if you're running windows, import os, then use os.system("cls"). Linux, os.system("clear"). If you're running it cross platform, you can use a ternary operator: os.system(["clear","cls"][os.name == "nt"]).

examples:
Code:
import os #1, Windows os.system("cls") #2, Linux/OSX os.system("clear") #3, cross platform os.system(["clear","cls"][os.name == "nt"])

Just a sidenote: you might want to write a method that gets the user information from a text file, like I did here using Ruby.
It's often the outcasts, the iconoclasts ... those who have the least to lose because they
don't have much in the first place, who feel the new currents and ride them the farthest.

Reply

RE: My First Program Help! #3
(09-29-2015, 10:44 PM)Gaige Wrote: if you're running windows, import os, then use os.system("cls"). Linux, os.system("clear"). If you're running it cross platform, you can use a ternary operator: os.system(["clear","cls"][os.name == "nt"]).

examples:
Code:
import os #1, Windows os.system("cls") #2, Linux/OSX os.system("clear") #3, cross platform os.system(["clear","cls"][os.name == "nt"])

Just a sidenote: you might want to write a method that gets the user information from a text file, like I did here using Ruby.

Thanks !

Reply