Get File's Permission Mask Using Python

Rajendra Dharmkar
Updated on 03-Oct-2019 05:57:13

333 Views

To get stat of a file, method stat() from the os module can be used. It performs a stat system call on the given path. For example,import os st = os.stat("file.dat")This function takes the name of a file, and returns a 10-member tuple with the following contents:(mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime)The mode variable gives you the information about file permissions. You can get it by st[0]. 

HTML5 Semantics

AmitDiwan
Updated on 01-Oct-2019 11:58:14

955 Views

The HTML5 Semantics refers to the semantic tags that provide meaning to an HTML page. In HTML5 the tags are divided into two categories - semantic and non-semantic. HTML5 brings several new semantic tags to the HTML.Some HTML5 Semantic tags are −TagsExplanationfigureIt specifies an image with different formats.articleIt specifies an independent self-containing article.navIt specifies a container for navigation links.asideIt specifies a tag for content aside from main content (like a sidebar).sectionIt represents a section in a document.detailsIt specifies a tag for additional details.headerIt specifies a header for a section or for a document.footerIt specifies a footer for a section or ... Read More

HTML Form Action Attribute

AmitDiwan
Updated on 01-Oct-2019 11:55:02

2K+ Views

The HTML form action attribute defines where to send the form data when a form is submitted in an HTML document.SyntaxFollowing is the syntax −Let us see an example of HTML Form action Attribute −Example Live Demo    body {       color: #000;       height: 100vh;       background: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%) no-repeat;       text-align: center;    }    input {       width: 315px;       display: block;       margin: 1rem auto;       border: 2px solid #fff;       padding: 8px;   ... Read More

HTML Window SessionStorage Property

AmitDiwan
Updated on 01-Oct-2019 11:51:40

347 Views

The HTML Window sessionStorage property allow us to store key/value pairs data in a web browser only for one session that means the data is deleted when the browser tab is closed.SyntaxFollowing is the syntax −window.sessionStorageLet us see an example of HTML Window sessionStorage Property −Example Live Demo    body {       color: #000;       height: 100vh;       background-color: #8BC6EC;       background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%) no-repeat;       text-align: center;    }    .btn {       background: #db133a;       border: none;       ... Read More

HTML window.self Property

AmitDiwan
Updated on 01-Oct-2019 11:48:09

190 Views

The HTML Window self property returns the current window of the browser.SyntaxFollowing is the syntax −window.selfLet us see an example of HTML Window self Property −Example Live Demo    body {       color: #000;       height: 100vh;       background-color: #8BC6EC;       background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%) no-repeat;       text-align: center;    }    .btn {       background: #db133a;       border: none;       height: 2rem;       border-radius: 2px;       width: 30%;       display: block;       ... Read More

HTML window.top Property

AmitDiwan
Updated on 01-Oct-2019 11:45:43

378 Views

The HTML Window top property returns the topmost browser window of the current window.SyntaxFollowing is the syntax −window.topLet us see an example of HTML Window top Property −Example Live Demo    body {       color: #000;       height: 100vh;       background-color: #8BC6EC;       background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%) no-repeat;       text-align: center;    }    .btn {       background: #db133a;       border: none;       height: 2rem;       border-radius: 2px;       width: 30%;       display: block;   ... Read More

HTML window.resizeTo() Method

AmitDiwan
Updated on 01-Oct-2019 11:41:39

397 Views

The HTML Window resizeTo() method resize a window relative to its current size by the specified values.SyntaxFollowing is the syntax −window.resizeTo(w, h)Here w and h define the value of resizing the window width and height in pixels respectively.Let us see an example of HTML Window resizeTo() Method −Example Live Demo    body {       color: #000;       height: 100vh;       background-color: #8BC6EC;       background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%) no-repeat;       text-align: center;    }    .btn {       background: #db133a;       border: none;   ... Read More

HTML window.resizeBy Method

AmitDiwan
Updated on 01-Oct-2019 11:38:14

151 Views

The HTML Window resizeBy() method resize the window relative to its current size by the specified values.SyntaxFollowing is the syntax −window.resizeBy(w, h)Here, w and h define the value of resizing the window width and height in pixels respectively.Let us see an example of HTML Window resizeBy() Method −Example Live Demo    body {       color: #000;       height: 100vh;       background-color: #8BC6EC;       background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%) no-repeat;       text-align: center;    }    .btn {       background: #db133a;       border: none;   ... Read More

Generate XML Documents with Namespaces in Python

Rajendra Dharmkar
Updated on 01-Oct-2019 11:36:28

2K+ Views

Currently you cannot add namespaces to XML documents directly as it is not yet supported in the in built Python xml package. So you will need to add namespace as a normal attribute to the tag. For example,import xml.dom.minidom doc = xml.dom.minidom.Document() element = doc.createElementNS('http://hello.world/ns', 'ex:el') element.setAttribute("xmlns:ex", "http://hello.world/ns") doc.appendChild(element) print(doc.toprettyxml())This will give you the document,

Print to the Screen Using Python

Rajendra Dharmkar
Updated on 01-Oct-2019 11:34:57

846 Views

The basic way to do output to screen is to use the print statement.>>> print 'Hello, world' Hello, worldTo print multiple things on the same line separated by spaces, use commas between them. For example:>>> print 'Hello, ', 'World' Hello, WorldWhile neither string contained a space, a space was added by the print statement because of the comma between the two objects. Arbitrary data types can also be printed using the same print statement, For example:>>> import os >>> print 1, 0xff, 0777, (1+5j), -0.999, map, sys 1 255 511 (1+5j) -0.999 Objects can be printed on the same line ... Read More

Advertisements