[Tutor] a beginning question

2016-02-20 Thread Paul Z
Hi all, I receive the string messages from my Mobile via UDP as below: A, 0.1, 0.6, 0.7 B, 0.2, 0.3, 0.8 I want to arrange them to two array as below: a = (0.1, 0.6, 0.7) b = (0.2, 0.3, 0.8) all the number are float. Thanks! Paul Z ___ Tutor mailli

Re: [Tutor] a beginning question

2016-02-20 Thread Alan Gauld
On 20/02/16 09:15, Paul Z wrote: > Hi all, > > I receive the string messages from my Mobile via UDP as below: > A, 0.1, 0.6, 0.7 > B, 0.2, 0.3, 0.8 I think we need a bit more detail. How do you receive these messages? UDP requires some kind of receiving service, so what is it that is receiving th

Re: [Tutor] a beginning question

2016-02-20 Thread Paul Z
Hi, I writed some codes as the UDP messages: import socket import random from array import * port = 8088 host = "localhost" s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) num = array('f') x = 0 while x < 6:     num.append(random.random())     x += 1 a0 = str("%.2f"%num[0]) + ',' a1 = st

Re: [Tutor] a beginning question

2016-02-20 Thread Peter Otten
Paul Z wrote: > Hi, > > I writed some codes as the UDP messages: > > import socket > import random > from array import * > > port = 8088 > host = "localhost" > > s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) > > num = array('f') > x = 0 > while x < 6: > num.append(random.random()) > x +

Re: [Tutor] a beginning question

2016-02-20 Thread Alan Gauld
On 20/02/16 13:23, Paul Z wrote: > Hi, > > I writed some codes as the UDP messages: > > import socket > import random > from array import * > > port = 8088 > host = "localhost" > > s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) > > num = array('f') > x = 0 > while x < 6: > num.append

[Tutor] How to run a python script

2016-02-20 Thread Erol Gericke
I want learn Python programming. Many years ago I taught myself BASIC so I have some programming experience. I have installed Python 2.7.11 and Notepad ++ on my Win 7 computer. I have also edited the PATH variable to include C:\Python27. However I am unable to run any scripts. When I type (

Re: [Tutor] How to run a python script

2016-02-20 Thread Chris Warrick
On 20 February 2016 at 17:25, Erol Gericke wrote: > I want learn Python programming. Many years ago I taught myself BASIC so I > have some programming experience. > > I have installed Python 2.7.11 and Notepad ++ on my Win 7 computer. I have > also edited the PATH variable to include C:\Python27.

Re: [Tutor] How to run a python script

2016-02-20 Thread Alan Gauld
On 20/02/16 16:25, Erol Gericke wrote: > However I am unable to run any scripts. > > When I type (into the COMMAND PROMPT window) python test.py or > python C:\python27\test.py I get SyntaxError: invalid syntax As Chris has hinted it sounds like you are running the script at the wrong comma