[Tutor] A Question Regarding the Documentation Format

2017-09-24 Thread Prateek
Hi Whenever I use help(input) inside Python shell i get the following output: >>> >>> help(input) Help on built-in function input in module builtins: input(...) input([prompt]) -> string I want to know what the significance of "-> string". I have tried consulting several books but none of

Re: [Tutor] A Question Regarding the Documentation Format

2017-09-24 Thread Chris Warrick
On 23 September 2017 at 15:15, Prateek wrote: > input(...) > input([prompt]) -> string > > I want to know what the significance of "-> string". I have tried > consulting several books but none of them gave me a clear-cut explanation > for this. This indicates the return type: input() returns

[Tutor] Converting a string to a byte array

2017-09-24 Thread Phil
Thank you for reading this. The following code sends "Fred" to my serial connected device without any problems. import serial ser = serial.Serial('/dev/ttyACM0',9600) ser.write(b'Fred\n') I'm trying to do the same under pyqt but I'm having trouble converting a string to a byte array. This

Re: [Tutor] Converting a string to a byte array

2017-09-24 Thread Peter Otten
Phil wrote: > Thank you for reading this. > > The following code sends "Fred" to my serial connected device without > any problems. > > import serial > > ser = serial.Serial('/dev/ttyACM0',9600) > ser.write(b'Fred\n') > > > I'm trying to do the same under pyqt but I'm having trouble convertin

Re: [Tutor] A Question Regarding the Documentation Format

2017-09-24 Thread Peter Otten
Prateek wrote: > Hi > > Whenever I use help(input) inside Python shell i get the following output: > help(input) > Help on built-in function input in module builtins: > > input(...) > input([prompt]) -> string > > I want to know what the significance of "-> string". I have tried

Re: [Tutor] Converting a string to a byte array

2017-09-24 Thread Cameron Simpson
On 24Sep2017 20:24, Phil wrote: I'm trying to do the same under pyqt but I'm having trouble converting a string to a byte array. This works correctly from the pyqt IDE but not from the console. python3 mycode.py generates "typeError: string argument without an encoding" Is it possible your p

Re: [Tutor] Converting a string to a byte array

2017-09-24 Thread Phil
On 25/09/17 07:26, Cameron Simpson wrote: Thank you Cameron and Peter for your replies. I don't understand why this works from the pyqt IDE but not when run from the console. I suppose the IDE is adding the correct encoding. I'm guessing the IDE is python 2 and not doing any encoding at all. I

Re: [Tutor] Converting a string to a byte array

2017-09-24 Thread Cameron Simpson
On 25Sep2017 09:29, Phil wrote: On 25/09/17 07:26, Cameron Simpson wrote: I don't understand why this works from the pyqt IDE but not when run from the console. I suppose the IDE is adding the correct encoding. I'm guessing the IDE is python 2 and not doing any encoding at all. In python 2 s