Posts
 
Reputation
Joined
Last Seen
Ranked #33
Strength to Increase Rep
+16
Strength to Decrease Rep
-4
98% Quality Score
Upvotes Received
1K
Posts with Upvotes
1K
Upvoting Members
383
Downvotes Received
26
Posts with Downvotes
25
Downvoting Members
16
250 Commented Posts
~3.73M People Reached
About Me

Mind explorer.

Interests
Logic, psychology, mathematics.
PC Specs
Kubuntu 16.04 Xenial Xerus
Favorite Tags
Member Avatar for vegaseat

@urireo561 You can use pythonmagick or another imagemagick python binding to resize the image. See this snippet for example https://www.daniweb.com/programming/software-development/code/463880/resize-an-image-with-pythonmagick

Member Avatar for CodeWorked
1
22K
Member Avatar for daviddoria

This is what I have [code=python] >>> from wxPython.wx import * __main__:1: DeprecationWarning: The wxPython compatibility package is no longer automatically generated or actively maintained. Please switch to the wx package as soon as possible. >>> import wx >>> [/code]

Member Avatar for Reverend Jim
0
2K
Member Avatar for nunos

HTML is a special case of XML, the difference is that in an XML file, you can have arbitrary tags, like [icode]<nunos>hello</nunos>[/icode]. So, if a library can parse XML, it can also parse HTML and other specialisations of XML, like MATHML, etc. That's why most libraries are designed for XML. …

Member Avatar for r8lst
0
798
Member Avatar for linux

[QUOTE=docdawning;1059689]Sure Python requires memory management, but if you provide a bare-metal type OS beneath the interpreter, somewhat like how BIOS provides a compatibility layer, then you could set out to write an OS that's extremely heavily implemented with Python. Still, doing so would require an intimate understanding of the plumbing …

Member Avatar for Thulan
2
2K
Member Avatar for danibootstrap

I suppose that you can obtain the implementation of `ioctl()` by downloading the source code of the `glibc` library [http://ftp.gnu.org/gnu/glibc/](http://ftp.gnu.org/gnu/glibc/).

Member Avatar for Bazirao
0
1K
Member Avatar for soibac

see [this thread](http://www.daniweb.com/software-development/python/threads/463434/pyqt4-problem). It looks like the same issue.

Member Avatar for RespectedCow
0
10K
Member Avatar for joe82

> I also want to remove header line (first line) and want to catenate rest of the lines. This code removes the first line of a file and prints the rest, concatenated whith open("myfile.txt", "rb") as ifh: next(ifh) # skip first line print(''.join(x.rstrip('\n') for x in ifh)) # read the …

Member Avatar for vishakha_3
0
22K
Member Avatar for adam291086

Because as you defined it, send_SMS is a method of the class sendmessage. So when you call [icode]x.send_SMS('error')[/icode], 2 arguments are passed, the first is [icode]x[/icode], the other is [icode]'error'[/icode]. There are 2 solutions, either you add an argument: [icode]def send_SMS(self, message):[/icode], or, if you don't need the instance, you …

Member Avatar for chethan_2
0
14K
Member Avatar for tony75
Member Avatar for Andreas_7
0
22K
Member Avatar for jozz3
Member Avatar for Smartfitness33
0
8K
Member Avatar for Tuấn_4
Member Avatar for ZZMike

Standard builtin functions have been tested gazillion times by programs all around the world. It is almost impossible that you discover an unknown bug in them. `strip()` removes characters only at both ends of the string. You will have to use `replace()` >>> 'qazxswedc'.replace('x', '') 'qazswedc'

Member Avatar for tinstaafl
0
13K
Member Avatar for OsaMasw

It looks more like a windows question than a linux question. I think the [plink.exe ](http://the.earth.li/~sgtatham/putty/0.52/htmldoc/Chapter7.html) tool can execute remote commands through ssh.

Member Avatar for extr3mex
0
564
Member Avatar for majestic0110
Member Avatar for Baneeishaque
1
10K
Member Avatar for fifarulez

I've been learning python for more than 20 years. It is an endless quest.

Member Avatar for Amelia28
0
360
Member Avatar for vegaseat

There are [good functions](http://tnt.math.se.tmu.ac.jp/nzmath/manual/modules/prime.html) in the [nzmath](http://tnt.math.se.tmu.ac.jp/nzmath/) module. Here is a session with python 2.7 in linux >>> import nzmath >>> from nzmath.prime import primeq /usr/local/lib/python2.7/dist-packages/nzmath/config.py:328: UserWarning: no datadir found warnings.warn('no datadir found') >>> primeq(9999991) True >>> import timeit >>> find_function = 'from __main__ import primeq' >>> stmt = 'primeq(9999991)' …

Member Avatar for paddy3118
1
2K
Member Avatar for vegaseat
Member Avatar for amir_19
3
24K
Member Avatar for RAZ_2

You could use `itertools.groupby` and `collections.Counter`. Something along the lines of newip = [] c = Counter() for key, group in groupby(logfile, key=lambda e: e.split('.',1)[0]): for entry in group: c.update(re.findall(r'[0-9]+(?:\.[0-9]+){3}', entry)) newip.extend(ip for ip, cnt in c.items() if cnt > 10) c.clear() newblist = blacklist + newip The groupby() groups …

Member Avatar for tdsan
0
16K
Member Avatar for vegaseat

Here is a perhaps more readable version try: from Tkinter import * except ImportError: from tkinter import * import time root = Tk() clock = Label(root, font=('times', 20, 'bold'), bg='green') clock.pack(fill=BOTH, expand=1) def tick(): s = time.strftime('%H:%M:%S') if s != clock["text"]: clock["text"] = s clock.after(200, tick) tick() root.mainloop()

Member Avatar for Vinay_17
2
26K
Member Avatar for HiHe

This deserves an answer: ''' tk_button_toggle5.py ''' from functools import partial import itertools import sys python2 = sys.version_info[0] == 2 tk = __import__("tT"[python2] + "kinter") def toggle(button): button.state = not button.state button['text'] = str(button.state) def new_btn(state): btn = tk.Button(width=12) btn.state = bool(state) btn.config(text= str(btn.state), command = partial(toggle, btn)) btn.pack(pady=5) return …

Member Avatar for martineau
1
21K
Member Avatar for novice20

[QUOTE=novice20;1448561]And... import in script2 worked fine when mode_check() was defined before main. Please let me know, why is it wrong to define a function before main, if it is so? and why did it work now?[/QUOTE] Your problem is a circular import like this [code=python] # in module A import …

Member Avatar for Cisco_1
0
37K
Member Avatar for happygeek

I don't think it's correct to blame Google for Q&A sites' success. I think these sites meet a specific programmers' need: we want to use software and libraries and we don't have time to learn APIs or read every manual. So we need expert answers to specific use cases. The …

Member Avatar for Dani
10
3K
Member Avatar for HAMMAD_5

You can try [Qwant](https://www.qwant.com/) [Qwant](https://www.qwant.com/?q=foobar&t=all), although it is said to be bing + privacy.

Member Avatar for Christiana_1
0
1K
Member Avatar for usman_14
Member Avatar for Elizabeth_13

The problem is that you write `from tkinter import *` after `from graphics import *`. Some objects defined in the [graphics.py](https://pypi.org/project/graphics.py/) package get shadowed by objects defined in the tkinter package. In this case, the graphics.py [Text](http://mcsp.wartburg.edu/zelle/python/graphics/graphics/node11.html) class is shadowed by the tkinter [Text](http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/text.html) widget. The best thing to do …

Member Avatar for Gribouillis
0
766
Member Avatar for lewashby

The best layout for french is the [BÉPO](https://en.wikipedia.org/wiki/Keyboard_layout#B%C3%89PO) layout. Install it and switch the layout everytime you want to type in French.

Member Avatar for Gribouillis
0
886
Member Avatar for davy_yg

I don't know the answer, but this is what I read in django's documentation > It is always better for security to deploy your site behind HTTPS. Without this, it is possible for malicious network users to sniff authentication credentials or any other information transferred between client and server, and …

Member Avatar for Neena_3
0
494
Member Avatar for Basel_1

The first thing is to never have variable names containing a variable index, such as `product_1, product_2,` etc. Use lists or tuples instead pairs = [ ("Flake", 0.55), ("Wispa", 0.50),("Crunchie", 0.65), ("Milky Way", 0.35), ("Boost", 0.65) ] product, product_price = zip(*pairs) Then `product[0]` is `'Flake'`,` product[4]` is `'Boost'` and similarly …

Member Avatar for Reverend Jim
0
21K
Member Avatar for Tony_9
Member Avatar for Ankush_4
0
13K
Member Avatar for nadiam

Read the file by chunks and also write chunks: with open("portrait1.dng", "rb") as binaryfile : with open("readfile.raw", "wb") as newFile: while True: chunk = binaryfile.read(4096) if not chunk: break newFile.write(binascii.hexlify(chunk)) > my whole university life is on this (translation, if it dies i die). Make sure you backup your files …

Member Avatar for Gribouillis
0
54K