And what is the data type of indata?
richieking 44 Master Poster
richieking 44 Master Poster
And what is the data type of indata?
Call the function where needed to perform its duties.
;)
Do you have to use the graphic module ???
Sometimes binding 2 events need a skip() function. eg.
def more_proc(self,event):
"""do your stuff here and call the skip() after that."""
skip() ## needed so that the event fall through to another event
Try including that. ;)
Great i just checkup your link. very nice article.
But you can create the same stuff using threading and socket.
My problem is what are you trying to achieve? I am very curious.
;)
I get you but it seems you are now confused. This is python forum.....
In all of this, you must have a running server to communicate with your sockets request.
Look , just write something dowm ok. Show us what you get so far ;)
now i got your problem understood.
using socket mean you must have a socket receiver/connecter at the other end for sync,
can you actually tell us what you want to achieve and perharps we can help you with a simple way out?
Are you with me my friend? just loop on the ips and try/except, very easy ;)
you can also make a list of your ips and work your way out if you know what i mean.
You can even give any number of threads per ip.
why hard coding?
you can loop through your ips without any issue.;)
gethostbyname / gethostbyaddress will always provide the main ip. That is if the sever is a shared hosting type.
Why not simply provide the ip address you want to bind to?
Because gap is always greater than 1 so the if text never get executed.
;)
can you provide a demo version of the sort of data you want to work with?
can you give more idea what your code is supposed to do?
without lib..... there is no much you can do with images.
i dont get Mr. dmurder.....
can you help us to help you. Until now no one jnows what you want to achieve.
well goodluck ;)
dmurder got his homework everywhere....
Why not just provide text to every field what sort of inputs acceptable....
Won't that be more robust?
;)
Novice20 just doesnt want to do or take advice. ;)
I think he ment printing image just like printing plain txt files.
No you cant print image like that. Thay can be worked on and as Gribouillis stated. You can read in work on it, then save the image.
Using PIL module or Image module will give you very interesting pic manipulation methods. croping,scalling,alpha,color changing, just like photoshop does.
And do you have any idea that you will need authentication to connect and do other stuff on the remote system. urlib will give you the control to work with url, that is internet checkups,webpage scrapping but will not give you chance to manipulate data on the remote system. The remote system must have a webserver runing also.
Well i have already pointed you to the right direction but the choice is yours ;)
I realy dont get what you want but i just optimised your code. Hope it helps
def getScores(totalScores, number):
score = input('Enter their score: ')
while score <=0 or score >=100:
print'You must enter a number between 0 and 100'
score = input('Enter a number between 0 and 100:')
for counter in range(0, number):
totalScores = totalScores + score
return totalScores
Your code was just missing the indentation to exclude the for loop from the while.
The for loop could not run unless the while look kicks in.
;)
Just look for close thread button and use it to close the thread.;)
well i was once like you. ;)
if you are happy.... then close this thread safely
your paste came with line numbers. who wrote this class?
repaste again well... ;)
This thread is off the hook. Is this about reordering a dict in order(sorting) or printing and finding some words and their locations + ordering them ????
???? ;)
I dont know about Multiprocessing but i know that threading+socket will do this job without any issues at all.
;)
Try this.....
import re
WORDPERFECT="\x0a"
with open(wordsearch,"rb")as word:
buff=word.read()# You can also just read a small buffer to check. word.read(10)
if re.search("^(\\x0a)$", buff,re.M ):
print("Wordperfect registered")
print(buff.find(WORDPERFECT))
or this
from __future__ import print_function
products = ["YELLOW,SMALL,STRETCH,ADULT,T21fdsfdsfs",
"YELLOW,SMALL,STRETCH,ADULT,Tdsfs",
"YELLOW,SMALL,STRETCH,ADULT,TD"]
print([this.split(",")[0:-1] for this in products],end="")
##output##
[['YELLOW', 'SMALL', 'STRETCH', 'ADULT'], ['YELLOW', 'SMALL', 'STRETCH', 'ADULT'], ['YELLOW', 'SMALL', 'STRETCH', 'ADULT']]
Look for a close thread button and just do that.
:)
you are welcome ;)
OK put your cards on the table ...
what do you want to achieve? ;)
Do you want to strip all spaces ???
This will join all the text together.
New line is also counted as space so what are you realy looking for?
;)
Well get a pencil and a notebook. Always write down what you want your application to do and arreange them how they should work step by step.
Is a good idea to understand what you want to do. Dont rush with big tasks. Design by divide and conquer. Meaning make huge task very simplified. Comment your code for future. Leave space for improvements and updates.
Look through over and over. Once you get the idea....
Draw a flowchat or something. Put your ideas in a very human understandable way. No rushing,
Then start coding.
Thats my take ;)
just close the thread will you ? ;)
To do some transparent stuff worth looking into PIL module. combine PIL and wx as wx can not manipulate image well. It give very basic image manipulation features and that is all. wx was designed with GUI in mind. More on frames,windows, etc.
For example to write a GUI application to send and recieve msgs. You will need wx,socket,time... modules for more complex threading module also. For proper image manipulation wx and PILL module at least.
PIL will give you more including normal mixing and transformation animation style.
wx will not. mix the 2 modules else you can not achieve what you want.It very easy to use PIL
Very simple. ;)
With image stuff. Try and refresh after update. This will show image nicely else the output of your image will differ from OS to OS and you dont need that do you ?
:)
There are several ways to achieve this.
You can define enumration of colors. These color got id which are int. eg.
RED=200
BLUE=300
YELLOW=400
PINK=500
Then import random to rand the range from 200-500 by 100 (100,500,100)
Then provide the result in the bind method to set the color of the button.
2. You can also have a counter to count when ever the button is click and use the counter variable to help know which color come next.
You got the idea ? ;)
Polanski
rstrip()/strip() methods only strip well only on inputs. To make things simple.
if you recieve input from the user, then use the r/strip().
You can not use the strip only mechanism to strip a text file which is already formatted.
Also strip() methods will only strip the buffer provided. That means you can read word by word and strip them but what is the point as they will come striped already.
In short, only rstrip() will not get you what you want so tell your teacher ok?
;)
well i told you about that.... ;)
post your code again inside the code tags please.
That shouldnt be hard. How exactly is your text formatted? can you shoe a copy of that? or is the same as what you got up there.
This code would loop through 60/2 data combination (1 combination = TEXT + BINARY DATA). What I tried, was to read the entire data set, find the word "BASELINE", count characters to the end of the TEXT, and then read the BINARY DATA.
Ans also what you you mean by this.?? what is end of the text? Do you mean till you meet another baseline or what?
more info plz ;
Hi,
on #35 you provided a return statement. That is good but return will not print a value. you must either use a print there or use a print on #14 on the function.
Mixing print and return can get confuse noob. optimise that part. ok ?
;)
Just look around.. something live thread solved button or link.
and dont forget to upvote me. ;)
give me the upvote buddy ;)
Please mark thread as solved.
good luck ;)
well you can try this ok? GPL feel free to use it ;)
from __future__ import print_function
import re
with open("frisky.py","r") as file:
real_value=[ re.sub('[_\W]*', "", value) for value in file] #I could make all one-liner but i thought you may want to extend on the code. wont you? ;)
print("\n".join(real_value))
This code will strip every marks and punctiations for you provided the data without a headach ;) If you want your output together, remove "\n" from the join method
Number 2.
from __future__ import print_function
import re,urllib
file=urllib.urlopen("http://daniweb.com") # scrap daniweb
real_value=[ re.sub('[_\W]*', "", value) for value in file] # clean stuff
print("\n".join(real_value),end="") # output. toggle "\n" if you want all togeter
mmmmm well i like your code. ;)
nice tit bits
Well more streamlined
from __future__ import print_function
words=["happy",'monty python',"hello","zombi","bone","monty"]
print([x[:-1]+"ier" for x in words if x.endswith("y")] )
print([x+"r" for x in words if x.endswith("e")] )
Getting more interesting after i opened the show ;)