Ok so I'm running Python 3.2 and I've been trying to figure out for some time now how to set a global variable's value as some a user inputs, or at least call a value defined by an input in another function/save the string from an input so that once assigned.
I want to do this so I can request input to create a string and then retrieve that string in another function without re-requesting the input (though preferably that string value could be changable by recalling the function that requests the input), or whatever may achieve a similar effect.
An example code I was attempting to use to do this is:
x = input('message: ')
y = x[1:]
I expected python to print 'nything'
But when I try and run it I get an error:
Traceback (most recent call last):
File "C:/Users/Marcos C-S/Desktop/Chatango Bot files/testerying", line 6, in <module>
NameError: global name 'y' is not defined
Now, the program I'm actually trying to implement this method with is an IRC bot program and involves hundreds of lines of code so I'm not going to go into that unless absolutely necessary, but if the implementation doesn't make sense in this context, tell me so I can include more information.
I know it's possible to do this as I've seen it done by some peers, they just refuse to assist me...