Re: Checking if a text file is blank

2008-04-20 Thread prashanth
Hi

[EMAIL PROTECTED] wrote:
> Greetings!
> 
>  Is there any way in python to check if a text file is blank?


obviously there are many ways, one simple way is to check length if its 
None then the file is blank.


> 
> What I've tried to do so far is:
> 
> f = file("friends.txt", "w")
>   if f.read() is True:
>   """do stuff"""
>   else:
>   """do other stuff"""
>   f.close()

If checking the file is blank is what you are tying to do then why do 
you open the file in the write mode.




Prashanth
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python

2014-02-26 Thread prashanth B.G
Hi Karthik,

 Good that you have interest in switching to dev from admin
stuff. Since you are already an admin , you wouldn't have problems with
administrating an os (probabally weblogic deployment was on an ux/linux
machine) or a database. The requirements that you see are a mix of
different technologies for building a web application. But then Python and
Javascript are the two major ones which you will have to focus on .

Javascript is needed along with html and css for the front end alone . Most
of the times the front end is only a consumer of the information from the
backend except for the user interaction events where in information flows
in the opposite way. The backend has the bussiness logic implemented and
could be in any language here it is Python and of course this interacts
with the database. So you could ignore the rest of the technologies for a
while and learn Python till you become comfortable with - Maybe writing
small sysadmin scripts or anything which may be of personal interest to you
.

There are several tutorials which others have pointed out .. May be you can
take a look at http://swaroopch.com/notes/python/  (easy) or
http://www.diveintopython.net/  (slightly deeper) . Once you get a hold,
you could move on to Django which runs on top of Python to get a feel of
webframeworks . This would be the time when you would need to lean
javascript to make user interaction possible (JS is also a complete
language in itself and would need some weeks to start with).

The rest like mysql , html , css are something which you could learn when
the need arises since you don't have to go too deep into these and that the
basics are not too difficult to understand . Once you start working on web
dev stuff you will have to know the design patterns further of with mvc is
a part . This would definitely take some time and effort but it would
be worth learning .

Hope this helps :-)

Thanks.


On Thu, Feb 27, 2014 at 9:21 AM, Dennis Lee Bieber wrote:

> On Tue, 25 Feb 2014 17:27:19 -0800 (PST), Karthik Reddy
>  declaimed the following:
>
> >Thank you,
> >
> >but from by reaserch i got these requirements ..
> >
> >Python, django, Twisted, MySQL, PyQt, PySide, xPython.
> >
> > *Technical proficiency with Python and Django.
>
> Web application framework
>
> > *Technical proficiency in JavaScript.
>
> Client-side web application
>
> > *Experience with MySQL / PgSQL.
>
> Relational database -- unless you need to fully administer the
> DBMS or
> use direct/obscure commands, knowing generic SQL may be enough (note that
> Django will likely be using it's own ORM package so even SQL may not be
> needed)
>
> > *Unix/Linux expertise.
>
> Well... that implies being fluent in the OS (probably at the shell
> scripting level).
>
> > *Experience with MVC design patterns and solid algorithm skills.
>
> While I know the term, I've not had much experience with the
> application... Separation of the data (model) from the user interface
> (view) and the logic linking the two (controller).
>
> Algorithm is another matter (the word basically is equivalent to
> "recipe").
>
> >
> >Core Python, DJango Framework, Web2Py, Google App engine, CherryPy (
> Basic Introduction)
> >
> >The problem for me is whether i have to learn all these technologies to
> work as a python developer..
> >
>
> Django, Web2Py, GAE, CherryPy are all focused on /web-based/
> (HTTP/HTML) applications. Python is just the implementation language.
>
> If the goal is just pure Python none of those may be applicable.
> For
> example, my most recent Python task was to generate UDP data packets to be
> fed through "Cross Domain Solution" boxes... I had to generate packets of
> various sizes, with some variation of contents [stuff that was supposed to
> trigger "drop" or "edit" actions in the CDS box]. Wireshark was used to
> capture the out-bound packets and the CDS-passed in-bound packets. Python
> was used to match the Wireshark captures to produce an SQLite database.
> Another Python program then extracted the latency data [outbound timestamp
> vs inbound timestamp] for the packets and create a CSV file for Excel
> plotting.
>
> That's three Python programs, yet none are "web" related. They
> required
> an understanding of the socket library, threading [the SQLite database
> relied on threads to read the two Wireshark capture files, filtering out
> all but the packet time-stamp and data ID string, and a third thread to
> match the out/in packets for latency -- and reporting any missing packets],
> and CSV library. Oh, and development 

Re: IDE for python

2014-05-28 Thread prashanth B.G
Hi Sameer,

   Try pycharm, ninja ide, wings ide .. These are light and will
help you to get started. Later on you can switch to vim which has many
plugins for python.

   Also feel free to take a look at this link on stackoverflow
comparing different features .

http://stackoverflow.com/questions/81584/what-ide-to-use-for-python

Thanks.




On Wed, May 28, 2014 at 5:01 PM, Sameer Rathoud wrote:

> On Wednesday, May 28, 2014 4:21:22 PM UTC+5:30, Mihamina Rakotomandimby
> wrote:
> > On 05/28/2014 01:43 PM, Sameer Rathoud wrote:
> >
> > > Please suggest, if we have any free ide for python development.
> >
> >
> >
> > I think major IDEs in the place have their Python integration.
> >
> > Did you make some search and tried each one?
> >
> >
> >
> > With just the information you provided, every existing IDE is OK.
> >
> >
> >
> > - What didnt you like in IDLE?
> >
> > - What IDE do you use for anything else thant Python?
>
> for C++ and C# development I prefer visual studio and for C++ try outs
> even codeblock is ok
>
> For Java I use eclipse.
>
> But first time I am trying python. I was trying some UI  with python. I
> have installed wingide. But i didn't liked it because for licenses messages
> even in trial version.
>
> I was searching for spyder, but didn't got any helpful installable.
> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 
 *HAVE A NICE DAY *

 Prashanth
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: can someone explain the concept of "strings (or whatever) being immutable"

2014-06-02 Thread prashanth B.G
Hi Deb,

  Immutability means that once "This is a string" is created in
memory , the string cannot be changed. When we assign a_string with "A
different string" this "A different string" is in a new memory location
again (a new object) . "This is a string" and "A different string" are two
different objects which are in existence which have been assigned to the
variable a_string at different points in time.

  Now if  "This is a string" is no longer referenced in the scope
of the program , the reference count drops to zero at which point it is
taken out of memory. Even though we perform a string concatenation and
change the string from "A different string" to "A different string appended
with some more words" , a new object is created , the initial string "A
different string" is copied to this newly created object, "appended with
some more words" are added to arrive at the final "A different string
appended with some more words". The original "A different string" still
remains until the point wherein it is not longer referenced after which it
is cleaned up.

Thanks.


On Tue, Jun 3, 2014 at 10:36 AM, Deb Wyatt  wrote:

>
>
> > -Original Message-
> > From: b...@benfinney.id.au
> > Sent: Tue, 03 Jun 2014 14:54:01 +1000
> > To: python-list@python.org
> > Subject: Re: can someone explain the concept of "strings (or whatever)
> > being immutable"
> >
> > Deb Wyatt  writes:
> >
> >> [no text]
> >
> > Deb, can you expand a bit – and write the question in the body of your
> > message? It's not clear what you want explained.
> >
> > --
> >  \  “I hope if dogs ever take over the world, and they chose a |
> >   `\king, they don't just go by size, because I bet there are some |
> > _o__)   Chihuahuas with some good ideas.” —Jack Handey |
> > Ben Finney
> >
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> that's strange that you see no text.  The body of my email was as follows:
>
> """a_string = "This is a string"
> a_string is pointing to the above string
>
> now I change the value of a_string
> a_string = "This string is different"
> I understand that now a_string is pointing to a different string than it
> was before, in a different location.
>
> my question is what happens to the original string??  Is it still in
> memory somewhere, nameless?
> """
> That was just the first question.  What does immutable really mean if you
> can add items to a list? and concatenate strings?  I don't understand
> enough to even ask a comprehensible question, I guess.
>
>
> Thanks in advance,
> Deb in WA, USA
>
> 
> FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!
> Check it out at http://www.inbox.com/earth
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 
 *HAVE A NICE DAY *

 Prashanth
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Beginner's guide to Python

2013-09-04 Thread prashanth B.G
Hi Steve ,

   These links might be of help .

   http://swaroopch.com/notes/python/   -- Very well explained for
beginners

   http://www.diveintopython.net/  -- Must read to pick up advanced
stuff . This can also be used as a starting point to figure out what python
might be used for .


  Hope this works for you .

Thanks.


On Wed, Sep 4, 2013 at 10:56 AM, Steve Hayes  wrote:

> Can anyone recommend a web site that gives a good beginner's guide to
> Python?
>
> One that tells one, especially --
>
> -- what kind of projects Python is good for
> -- what kind of projects it is not good for
> -- a simple explanation of how it works
> -- a kind of beginner's tutotial and guide to its syntax
>
> I've read about Python, and installed it on my computer when I found it on
> a
> DVD that came with a magazine, but I haven't got a clue about how to use
> it.
>
> So any advice on the best web sites for absolute novices would be welcome.
>
>
> --
> Steve Hayes from Tshwane, South Africa
> Blog: http://khanya.wordpress.com
> E-mail - see web page, or parse: shayes at dunelm full stop org full stop
> uk
> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 
 *HAVE A NICE DAY *

 Prashanth
-- 
https://mail.python.org/mailman/listinfo/python-list


Xml writing in Python and verifying using XSD

2005-05-27 Thread Prashanth Ellina
Hi,

I need to write some data to an xml file. I have an XML Schema defined.
I would like to use some mechanism of writing the data to the xml file
and having exceptions thrown back to me when the data is invalid.

I have looked at xml.dom and xml.dom.minidom but could not figure out
what to do to include xml validation using the xsd while writing.

Any ideas?

Thanks in advance,
Prashanth Ellina

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Xml writing in Python and verifying using XSD

2005-05-29 Thread Prashanth Ellina


Diez B. Roggisch wrote:

> Use StringIO to capture the output of your writings, and use a
> xsd-validating parser (not sure which one, but google should help) to
> reread that. Or a temporary file.

Thank you very much. I'll try that.

-- 
http://mail.python.org/mailman/listinfo/python-list


How do I know when a thread quits?

2005-06-07 Thread Prashanth Ellina
Hi,

I have used the low-level thread module to write a multi-threaded app.

tid = thread.start_new_thread(process, ())
tid is an integer thread ident.

the thread takes around 10 seconds to finish processing. Meanwhile the
main thread finished execution and exits. This causes an error because
the child thread tries to access something in the sys module which has
already  been GC'ed.  I want a reliable way of knowing when the child
thread finished execution so that I can make the main thread wait till
then.

Any ideas?

TIA,
Prashanth Ellina

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Another solution to How do I know when a thread quits?

2005-06-09 Thread Prashanth Ellina
Hi,

Thanks for the code sample. I will try it out. I guess there is no
reliable way to get away with just the "threads" module.

Thanks,
Prashanth Ellina

-- 
http://mail.python.org/mailman/listinfo/python-list