[Tutor] getting input for stdin
diliup gabadamudalige
diliupg at gmail.com
Sun Dec 7 18:38:02 CET 2014
Dear alll,
my code is given below
if __name__ == '__main__':
p = os.getcwd()
filename = "\get scale of choice.txt"
filepath = p + filename
sys.stdout = open(filepath, "w")
os.startfile(filepath)
for i in data.info: # print all the scale info to window
print i
run = True
while run:
scaletemplate = ["C", "D", "E", "F", "G", "A", "B"]
getscale = sys.stdin.raw_input(filepath)
#getscale = raw_input("Which scale do you require?:")
if len(getscale) > 1:
getscale = getscale[0].upper() + getscale[1:]
else:
getscale = getscale.upper()
if getscale in data.scalenames:
scale = main(getscale)
print scale
elif getscale == "Q" or getscale == "X" or getscale == "":
run = False
print"exiting..."
else:
print "No such scale"
I need to get the stdin input from the text I type into the same text file
that I have stdout at. How do I do that. None of the answers at
stackoverflow got me going. Any help on a code snippet would be appreciated.
Thanks in advance
--
Diliup Gabadamudalige
http://www.diliupg.com
http://soft.diliupg.com/
**********************************************************************************************
This e-mail is confidential. It may also be legally privileged. If you are
not the intended recipient or have received it in error, please delete it
and all copies from your system and notify the sender immediately by return
e-mail. Any unauthorized reading, reproducing, printing or further
dissemination of this e-mail or its contents is strictly prohibited and may
be unlawful. Internet communications cannot be guaranteed to be timely,
secure, error or virus-free. The sender does not accept liability for any
errors or omissions.
**********************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20141207/c2c38ca7/attachment-0001.html>
More information about the Tutor
mailing list