- Strength to Increase Rep
- +16
- Strength to Decrease Rep
- -4
- Upvotes Received
- 1K
- Posts with Upvotes
- 1K
- Upvoting Members
- 383
- Downvotes Received
- 26
- Posts with Downvotes
- 25
- Downvoting Members
- 16
Mind explorer.
- Interests
- Logic, psychology, mathematics.
- PC Specs
- Kubuntu 16.04 Xenial Xerus
Re: Try `print(pd)` to see where this pandas comes from. | |
Re: @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 | |
Re: 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] | |
Re: 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. … | |
Re: [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 … | |
Re: 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/). | |
Re: see [this thread](http://www.daniweb.com/software-development/python/threads/463434/pyqt4-problem). It looks like the same issue. | |
Re: > 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 … | |
Re: 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 … | |
Re: Perhaps a `sudo apt-get install python-pyside` (or python3-pyside). | |
Re: I would use [code=python] Calculate = sum [/code] instead of the above code ;) | |
Re: 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' | |
Re: 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. | |
Re: Majestic0100 is probably working on another project now as this thread was started 8 years ago! | |
Re: I've been learning python for more than 20 years. It is an endless quest. | |
Re: 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)' … | |
Re: Read this [url]http://www.daniweb.com/forums/announcement.php?f=8&announcementid=3[/url] | |
Re: 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 … | |
Re: 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() | |
Re: 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 … | |
Re: [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 … | |
Re: 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 … | |
Re: 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. | |
Re: 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 … | |
Re: 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. | |
Re: 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 … | |
Re: 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 … | |
Re: I think [shutil.copytree](http://docs.python.org/2/library/shutil.html#shutil.copytree) should work. | |
Re: 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 … |