473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to check if OS is unix or pc

In Matlab, there is a "isunix" command.
Is there something similar in python?

Thanks!
bahoo

Apr 3 '07 #1
2 1852
bahoo a écrit :
In Matlab, there is a "isunix" command.
Is there something similar in python?
>>import os
os.uname()
('Linux', 'bibi', '2.6.9', '#1 Sun Dec 5 14:54:12 CET 2004', 'i686')
>>os.name
'posix'
>>isunix = lambda: os.name == 'posix'
isunix()
True

Note that if you worry about system-specific path separators, there's
the os.path module.
Apr 3 '07 #2
On Apr 3, 4:12 pm, "bahoo" <b83503...@yahoo.comwrote:
In Matlab, there is a "isunix" command.
Is there something similar in python?

Thanks!
bahoo
Check out the platform module. It should do what you need. The
"release()" method is especially useful.

Mike

Apr 3 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Dino | last post by:
dear all, i've created an application for a customer where the customer can upload ..csv-files into a specified ftp-directory. on the server, a php-script, triggered by a cronjob, reads all the...
27
by: John Roth | last post by:
PEP 263 is marked finished in the PEP index, however I haven't seen the specified Phase 2 in the list of changes for 2.4 which is when I expected it. Did phase 2 get cancelled, or is it just not...
4
by: eight02645999 | last post by:
hi i created a login page that authenticate the user and his/her password to the unix ssystem. what modules can i used to compare the unix password with what the user typed in the cgi form? the...
9
by: Jon LaBadie | last post by:
Suppose I'm using stdio calls to write to a disk file. One possible error condition is no space on file system or even (in unix environment) a ulimit of 0 bytes. Which calls would be expected to...
2
by: Janice | last post by:
How to obtain the lock status of a file held by other process? If I read the file that is locked by other process, the read would return -1. If the file is locked by other process, how to put the...
6
by: techBoy | last post by:
I am looking for a tool which can scan my source code and tell me if a header file gets included more then once in a sequence of source file or header files. Can some one guide me to such a tool !!
0
by: Tarun Arora | last post by:
Hi My Java application is deplyed on Unix Machine.When i select a check box on a JSP page,the value of the check box gets saved in the Database but the check box gets unselected on the JSP. Is...
9
by: Mark | last post by:
Hi all, This is something which has been bugging me for ages. How can I check if a file is already in use by a different program? It doesn't seem to matter which mode I pass to fopen, it will...
5
by: Guillaume Charhon | last post by:
Hi, I need do to a program that check if a pop server is alive. How can I do ? I am a beginner in network programming. Thank you for your help.
3
by: Javier | last post by:
Hello all, I need to know the protection of a memory region in UNIX (protected with mprotect) system call. Is there a way to do it? Thanks.
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.