Re: can we append a list with another list in Python ?

2012-10-23 Thread Adnan Sadzak
> ... but I'm not sure what you mean by "... with a for loop"?
>
>  -[]z.
>
>
Maybe this? :
-
x = [1,2,3]
y = [10,20,30]
for z in y:
 x.append(z)

print x
-

But list.extend should be right way.

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


Re: Read number of CSV files

2012-11-07 Thread Adnan Sadzak
Maybe os.listdir() can help You, and then go through files and do whatever
You want.


On Wed, Nov 7, 2012 at 11:11 PM, Smaran Harihar wrote:

> Hi Guys,
>
> I am able to read through a CSV File and fetch the data inside the CSV
> file but I have a really big list of CSV files and I wish to do the same
> particular code in all the CSV files.
>
> Is there some way that I can loops through all these files, which are in a
> single folder, and get my code to read the files?
>
> --
> Thanks & Regards
> Smaran Harihar
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem with importing in Python

2013-01-11 Thread Adnan Sadzak
Python is case sensitive.
Circle and circle is not same.




/* sent from android */
On Jan 11, 2013 11:22 PM, "su29090" <129k...@gmail.com> wrote:

> I'm trying to import a python file it keeps saying:
>
> ImportError: cannot import name Circle
>
> Here is the file I'm trying to import:
>
> Circle.py
>
> import math
>
> class circle:
> #Construct a circle object
> def __init__(self, radius = 1):
> self.radius = radius
>
> def getPerimeter(self):
> return 2 * self.radius * math.pi
>
> def getArea(self):
> return self.radius * self.radius * math.pi
>
> def setRadius(self, radius):
> self.radius = radius
>
> from Circle import Circle
>
> def main():
> #Create a circle with a radius 1
> circle1 = Circle()
> print("The area of the circle of radius",
>   circle1.radius, "is" , circle1.getArea())
>
> #Create a circle with a radius 25
> circle2 = Circle(25)
> print("The area of the circle of radius",
>   circle2.radius, "is" , circle2.getArea())
>
> #Create a circle with a radius 125
> circle3 = Circle(125)
> print("The area of the circle of radius",
>   circle3.radius, "is" , circle3.getArea())
>
> #Modify circle radius
> circle2.radius = 100 # or Circle2.setRadius(100)
> print("The area of the circle of radius",
>   circle2.radius, "is" , circle2.getArea())
>
> main() # Call the main function
>
> How can I solve this problem?
>
> Thanks in advance.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python adsl script

2014-01-14 Thread Adnan Sadzak
Hi,

You need to find out what communication type your router supports (most use
telnet, ssh, or http). It is easy to implement
solution using any of these protocols. If You have problems in
implementation, maybe we can help You, but will not write code for You.

For password..khm...as Denis says use google.
You can start with some questions to yourself and google:  What password?
Bios, boot loader, OS...?
No1 will do this for You and this is not list for that type of questions.

Cheers




On Tue, Jan 14, 2014 at 6:27 PM, ngangsia akumbo  wrote:

> what about a python script that can retrieve my entire isp setting from my
> adsl router.
>
> Any ideas
>
> Also my grand mother forget her computer password, she can only login
> through the guest account. what about a script that can solve that problem.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Opening the file in writing mode

2015-01-15 Thread Adnan Sadzak
Hi,

Yes, but You also can open an existing file in 'append' mode.

Cheers,
Adnan
On Jan 15, 2015 12:08 PM, "Abdul Abdul"  wrote:

> Hello,
>
> In the Python documentation, when opening the file in write mode, it
> mentions the following:
>
> *writing (truncating the file if it already exists)*
> What is meant by "truncating" here? Is it simply overwriting the file
> already existing?
>
> Thanks.
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Opening the file in writing mode

2015-01-15 Thread Adnan Sadzak
Hi,

in 'w' mode, if file does not exist it will create new one (if You have
permissions to write in specified location).
If file exist, it will 'truncate' it or like it is specified in
documentation "*(an existing file with the same name will be erased)*".

I'm not sure what You mean by "existing mode"? Maybe to open one file twice?
If You open file for reading, then open it again for writing - yes it will
be erased or as You said 'overwrite existing mode'. Is that what You think
about?


Kind regards,
Adnan


On Thu, Jan 15, 2015 at 12:19 PM, Abdul Abdul  wrote:

> Hi,
>
> Thanks for your reply. I just wanted to understand the 'w' mode in Python.
> So, when using it, it will overwrite any existing mode, right?
>
> Thanks.
>
> On Thu, Jan 15, 2015 at 12:13 PM, Adnan Sadzak  wrote:
>
>> Hi,
>>
>> Yes, but You also can open an existing file in 'append' mode.
>>
>> Cheers,
>> Adnan
>> On Jan 15, 2015 12:08 PM, "Abdul Abdul"  wrote:
>>
>>> Hello,
>>>
>>> In the Python documentation, when opening the file in write mode, it
>>> mentions the following:
>>>
>>> *writing (truncating the file if it already exists)*
>>> What is meant by "truncating" here? Is it simply overwriting the file
>>> already existing?
>>>
>>> Thanks.
>>>
>>> --
>>> https://mail.python.org/mailman/listinfo/python-list
>>>
>>>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Need help in Python automation

2014-03-21 Thread Adnan Sadzak
Hi,
there should be manufacturer documentation or API. What switch do You use?
Any other info?

Cheers,
Adnan


On Fri, Mar 21, 2014 at 9:14 AM, Anil Kumar A <401a...@gmail.com> wrote:

> -
> Hi All,
>
> I work for an ISP. Currently we bought few switches and routers. Python is
> available in that switches. So I would like to write some scipts which I
> can run inside switch.
>
> I tried module 'os, system', but It is not executing the commands in
> operational and configurational mode. Those modes' prompts are '*>' and
> '*#'.
>
> Can somebody suggest me, if there is any module which I can use to execute
> commands inside a switch.
>
> I don't want to use 'socket' module as I am not connecting the box and
> executing commands. I am running the script inside switch.
>
> Please give some clue to start my automation.
>
> Thanks!
>
> Anil Kumar A
>
> -
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Unpacking U-Boot image file

2014-04-09 Thread Adnan Sadzak
I belive you are trying to decompress some router images or router
backup/config files?
Check if maybe LZS.

Rustom gave You starting point.



On Wed, Apr 9, 2014 at 7:18 PM, Rustom Mody  wrote:

> On Wednesday, April 9, 2014 9:36:40 PM UTC+5:30, trewio wrote:
> > How to extract files from U-Boot image file, LZMA-compressed?
> >
> > Is there a Python script that can do this properly?
>
> For lzma theres this (recent) python library
> https://docs.python.org/dev/library/lzma.html
>
> Though you might just be better off with the command-line xz unxz etc
>
> After that.. whats the U-boot format?
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python and wireshark.

2014-07-01 Thread Adnan Sadzak
You can try scapy (http://www.secdev.org/projects/scapy/)


Cheers,
Adnan



On Tue, Jul 1, 2014 at 11:56 AM, Sean Murphy  wrote:

> All.
>
> Is there any way to use python with Wireshark/Tshark? I am not able to use
> the GUI due to my vision impairment. So I am thinking of using Wireshark
> libraries and Python to provide a text console environment. Tshark does
> give you command line capability. I am more seeking for the ability of
> changing things on the fly, rather then creating complex command line
> parameters.
>
>
> Thoughts?
>
>
> Sean
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list