Hi,
We need volunteer to conduct Basic Python workshop at Govt Engineering
college , Hassan on Sept 21st
Expected Student Strength : 60.
Travel and Food expense will be taken care by college.
With Thanks
Vijay
___
BangPypers mailing list
Jeffrey Jose writes:
[...]
> I come from a place where you use *batteries* as much as possible, and
> where shelling out is the last resort.
[...]
I think so too. Perl programmers are much more comfortable with the
whole qx business than Python programmers are with os and subprocess.
--
C
On Wed, Sep 11, 2013 at 9:02 PM, Vardhan Varma wrote:
> On Wed, Sep 11, 2013 at 8:42 PM, Pranjal Mittal <
> pranjal.mittal.ec...@iitbhu.ac.in> wrote:
>
> > Here you go-
> >
> > import socket
> > socket.gethostbyaddr(socket.gethostname())[2]
> >
> >
> > On Wed, Sep 11, 2013 at 8:16 PM, ashish makan
On Wed, Sep 11, 2013 at 8:42 PM, Pranjal Mittal <
pranjal.mittal.ec...@iitbhu.ac.in> wrote:
> Here you go-
>
> import socket
> socket.gethostbyaddr(socket.gethostname())[2]
>
>
> On Wed, Sep 11, 2013 at 8:16 PM, ashish makani >wrote:
>
> > Found this quick, nifty way to determine the ip address o
Here you go-
import socket
socket.gethostbyaddr(socket.gethostname())[2]
On Wed, Sep 11, 2013 at 8:16 PM, ashish makani wrote:
> Found this quick, nifty way to determine the ip address of the machine your
> py script is running on
>
> import commands
> commands.getoutput("/sbin/ifconfig").split
Found this quick, nifty way to determine the ip address of the machine your
py script is running on
import commands
commands.getoutput("/sbin/ifconfig").split("\n")[1].split()[1][5:]
( via http://stackoverflow.com/a/3177266/559456 )
cheers
ashish
*The only way to do great work is to love what y
1.
I do like the accessing dict attributes as keys and specifically where they
make more sense as structure by itselfI do use
class ABC(object):
a = ''
def __init__(self, **kwargs):
self.__dict__.update(**kwargs)
2. When creating a dictionary of constants create it dynamica
There are times when the project requires a large blob of data which needs
to be loaded with the python code. A general practice is to use pickle and
json object which is opened using file functions etc.
I tend to convert this kind of data (depending on size) into python file
using pprint and stor
Another script I use often is repr.
https://github.com/anandology/hacks/blob/master/repr
It reads each line from stdin and prints it as python repr. Useful to see
hidden/non-alphanumeric characters.
$ echo -e "a\bc"
c
$ echo -e "a\bc" | repr
a\x08c\n
This is similar to od, but od prints fixed n
This use case where one needs to keep related values together as logical
group:
Properties, getattr, setattr are quite interesting option but I prefer
collections.namedtuple
Example
EmployeeRecord = namedtuple('EmployeeRecord', 'name, age, title,
department, paygrade')
import csvfor emp in map(E
10 matches
Mail list logo