-
Replied To a Post in getting file from ftp or http web server
It seems to me that `urlretrieve()` answers your question. For ftp, the example at the top of the `ftplib` module's documentation shows how to download a file named README. Also … -
Replied To a Post in problem with output result to logfile
I think `logging.info()` should be `logger.info()`. -
Replied To a Post in using or, and byte.find
> do I not run the risk of having the artist or album strings broken across two line It seems unlikely, but the answer is probably in the technical specifications … -
Replied To a Post in using or, and byte.find
You must have done strange tests. Here is what it does Python 3.4.0 (default, Apr 11 2014, 13:05:11) [GCC 4.8.2] on linux Type "help", "copyright", "credits" or "license" for more … -
Replied To a Post in Python Help!
It is not true that `file`is a reserved word in python. `file` is the name of a standard type in python **2**. Using file as a variable name in python … -
Replied To a Post in using or, and byte.find
First note that due to [operator precedence](https://docs.python.org/3.3/reference/expressions.html#operator-precedence) the expression A or B in C is the same thing as A or (B in C) In particular if A is a non … -
Replied To a Post in Explanation of par below
If you want the names only (and not the values of the variables), you can use the `dir()` function. Names with double underscores on both sides are normally reserved for … -
Replied To a Post in Explanation of par below
> par in this case is a variable but in Python specifically its called a name Exactly. The namespaces are also called symbol tables. The functions `locals()` and `globals()` return … -
Replied To a Post in Explanation of par below
> In what way is the use of Parameters similar/different to Variables? Same thing? The correct python concept is the *namespace*. At any given moment in the execution of python … -
Gave Reputation to slate in Add attributes to function in python
I would create a decorator, that decorates the function. Something like: @menu_item(Name="Save", enabled=True) def save_menu(): function body The decorators would add a dictionary (for example with the name menu_data) to … -
Replied To a Post in Add attributes to function in python
Why not use a decorator ? #!/usr/bin/env python # -*-coding: utf8-*- from __future__ import (absolute_import, division, print_function, unicode_literals) __doc__ = '''adding attributes to a function ''' def menu_config(**attrs): def decorator(func): … -
Replied To a Post in Def
Apparently, the whole code depends on 2 values, `fileFull` and `fileAbriv`. So you can write a function def func(fileFull, fileAbriv): etc However, this code, with lines repeated with different variable … -
Gave Reputation to ZZucker in Explanation of par below
To get more information on **par** you can do this: # Importing support.py module import support support.print_func("Zara") # to get more insight ... import inspect print(inspect.getcallargs(support.print_func, "Zara")) ''' result ... … -
Replied To a Post in As a beginner, what IDE should I use?
I like [spyder](https://code.google.com/p/spyderlib/). A nice feature is that you can start working with a good old plain python file, while many IDE want you to define a project first. It … -
Replied To a Post in 4th dimension
> tell me why the dimension of Koch's curve is log(4)/log(3)? Suppose your Koch's curve is contained in a disk of radius 1, then by construction, it can be covered … -
Edited D-Day
Today is 70th anniversary of D-Day in France, with 20 heads of state, including Queen Elizabeth and Barack Obama ! Great weather and nice speeches ! https://twitter.com/FranceinChicago/status/474910715237502977/photo/1 Let's remember these 150000 … -
Replied To a Post in Can't convert 'int' object to str implicitly
Here is an explanation, first with a `list`, then with a `bytes`. `char[counter:counter+1]` is a slice, which has the same type as `char`, while `char[counter]` is an element. >>> L … -
Edited D-Day
Today is 70th anniversary of D-Day in France, with 20 heads of state, including Queen Elizabeth and Barack Obama ! Great weather and nice speeches ! https://twitter.com/FranceinChicago/status/474910715237502977/photo/1 Let's remember these 150000 … -
Created D-Day
Today is 70th anniversary of D-Day in France, with 20 heads of state, including Queen Elizabeth and Barack Obama ! Great weather and nice speeches ! https://twitter.com/FranceinChicago/status/474910715237502977/photo/1 Let's remember these 150000 … -
Replied To a Post in Can't convert 'int' object to str implicitly
There is also `artist.decode()`. -
Replied To a Post in how to use ast with python 2.7
First thing to do is to print the structure to see what it contains. I found a pretty printer [here](http://alexleone.blogspot.fr/2010/01/python-ast-pretty-printer.html) #!/usr/bin/env python # -*-coding: utf8-*- from __future__ import (absolute_import, division, … -
Replied To a Post in Can't convert 'int' object to str implicitly
I think you are mistaking `str` for `bytes` in python 3. In python 3, `str` are unicode strings (sequences of abstract unicode code points) and `bytes` are arrays of small … -
Replied To a Post in Project for beginners spellchecker
Add print(repr(word)) print(list) immediately before line 19 and post the output here. Also 'list' and 'dict' are so common words in python that nobody uses them for variables. -
Replied To a Post in Can't convert 'int' object to str implicitly
You're getting the error because `char` is of type `bytes`, and `char[counter]` is an integer. Also you initiliazed newchar as a `str`. At line 15, you can't add a str … -
Gave Reputation to bumsfeld in asksaveasfilename()... setting the extension... please help
[code]# the Tkinter filedialog for saving file # tkfd.asksaveasfile(**options) returns file handle to save to try: # Python2 import Tkinter as tk import tkFileDialog as tkfd except ImportError: # Python3 … -
Replied To a Post in Error in Code with Variables (Tkinter) Please help
I'm not an expert but I think `geometry()` applies to top level windows only. You may want to call OedipusFrame.winfo_toplevel().geometry(("%dx%d+0+0")%(OFWidth,OFHeight)) See also [here](http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/geometry.html). -
Edited Print with line and file information
This snippet defines a function `printat()` which adds line and file information to the normal `print()` function output. The intended use is a quick and dirty debugging information for everyday's … -
Edited Print with line and file information
This snippet defines a function `printat()` which adds line and file information to the normal `print()` function output. The intended use is a quick and dirty debugging information for everyday's … -
Edited Print with line and file information
This snippet defines a function `printat()` which adds line and file information to the normal `print()` function output. The intended use is a quick and dirty debugging information for everyday's … -
Edited Print with line and file information
This snippet defines a function `printat()` which adds line and file information to the normal `print()` function output. The intended use is a quick and dirty debugging information for everyday's … -
Edited Print with line and file information
This snippet defines a function `printat()` which adds line and file information to the normal `print()` function output. The intended use is a quick and dirty debugging information for everyday's … -
Created Print with line and file information
This snippet defines a function `printat()` which adds line and file information to the normal `print()` function output. The intended use is a quick and dirty debugging information for everyday's … -
Replied To a Post in EXTERMINATE!!!
Python only wraps the lower level system functions which open a file to create a file descriptor or a pointer to file, and the corresponding read or write functions. So, … -
Replied To a Post in Python challenge
You can perhaps add the condition that there is no uppercase letter before the first 3 ones or after the 3 last ones. -
Replied To a Post in Gui Interface Toolkits
Here are the [answers](http://bit.ly/1tum6qo). -
Replied To a Post in SymPy Plot doesn't open up plot windows!
`Plot` is deprecated (`pydoc sympy.Plot`). Use `plot` with small p instead. -
Replied To a Post in Program for Converting Quadratic Equations to Standard Form
It is very nice. I see 2 directions onwards: 1. Add interaction with the user to get the coefficients (raw_input, etc). 2. Use the fractions module from standard lib to … -
Gave Reputation to Tamara_1 in Program for Converting Quadratic Equations to Standard Form
Program For Standard Form def stnfrm(a,b,c): one = (b/(2.0*a)) two = c-((b**2.0)/(4.0*a)) axis = one/-1.0 x = -b/(2.0*a) y = a*(x**2.0)+(b*x)+c print x if a == 1: print "(x + … -
Gave Reputation to Tcll in how to get the column of a called function
got it working perfectly ^_^ http://tcll5850.proboards.com/thread/144/public-umc-discussion-thread?page=1&scrollTo=957 I completely forgot about the sys-global I'd defined to store all the functions as a particular ID for highlighting UMC's data types :P I … -
Replied To a Post in Tkinter Password with return/enter key (No button) Help!
The simplest way is import easygui word = easygui.passwordbox() You can then browse the easygui source code to learn how to make a passwordbox :) and remove the buttons if … -
Replied To a Post in How to use command line arguments
This is not a short example. I don't see where you need the args in the second script. I suggest another solution: write a third module, say `handleargs.py` # handleargs.py … -
Replied To a Post in How to use command line arguments
If you could give an example with two short scripts `first.py` and `second.py`, it may help. -
Replied To a Post in How to use command line arguments
> Is that the only way or is what im wanting to do even posisble What you want to do is not at all clear. -
Replied To a Post in How to use command line arguments
Your explanation is unclear. I don't think there is an issue. For example if the first file contains args = parser.parse_args() you can later call `foo(args)` and it doesn't matter … -
Replied To a Post in how to get the column of a called function
You could perhaps use the aspects module. Sometimes I use a simple tracing module which I wrote using aspects. The advantage of aspects is that methods are wrapped in a … -
Edited Pointed Set type
This snippet implements a pointed set, that is to say an ordinary set of elements with a distinguished element called the basepoint of the set. For example the seven days … -
Edited Pointed Set type
This snippet implements a pointed set, that is to say an ordinary set of elements with a distinguished element called the basepoint of the set. For example the seven days … -
Edited Pointed Set type
This snippet implements a pointed set, that is to say an ordinary set of elements with a distinguished element called the basepoint of the set. For example the seven days … -
Created Pointed Set type
This snippet implements a pointed set, that is to say an ordinary set of elements with a distinguished element called the basepoint of the set. For example the seven days … -
Gave Reputation to snippsat in Command line arguments python
Take a look at [Click](http://click.pocoo.org/) from the creator of [Flask](http://flask.pocoo.org/) Armin Ronacher.
The End.