So, I'm trying to assign some SQL to a variable which will later be executed in the code. I also want to include a varible inside the SQL. I am only allowed to code over 80 characters and then I have been told to use a black slash, now this causes a problem. Hopefully this better explains it: Current code- [CODE] sql_query = """"SELECT A1.value Value, COUNT(A1.value) "Frequency", A1.category Category' FROM popularity A1 WHERE Category = "books" GROUP BY A1.value""" [/CODE] I need to insert a varible here: [CODE]WHERE Category = [COLOR="red"]category[/COLOR][/CODE] Now that I think about it I might …
|+0 forum 1|
Anyone ever used the PIL (Python Image Library)? If you have, is there anyway to convert a single pixel at a time in a bmp file? I'm trying to invert a black and white image to white and black. So: [code=python] import PIL image = Image open(filename) pixels = list(image.getdata()) #insert someway to invert the pixels image.putdata(pixels) image.save('new.bmp') [/code] I think I also have to use a for pixel in pixels loop. I know there are easier ways with the in-built functions but I have to do it this way.
|+0 forum 2|
Hi, I'm trying to convert a textfile which is set out like this: 1[Tab]Hello 2[Tab]Test into a Python dictionary how would I be able to do it? Thanks
|+0 forum 3|