Sponsored Content
Full Discussion: Python Combing Two Commands
Top Forums Shell Programming and Scripting Python Combing Two Commands Post 302948553 by wisecracker on Tuesday 30th of June 2015 11:22:57 AM
Old 06-30-2015
One liner Python code is not easy:-
OSX 10.7.5, running python 3.4 inside a default bash terminal.
This is why I have switched to shell scripting...
Code:
Last login: Tue Jun 30 15:55:49 on ttys000
AMIGA:barrywalker~> python3.4
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 00:54:21) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> x=0
>>> while True:
...         print(x)
... 
0
0
0
0
.
.
0
0
^C0
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
KeyboardInterrupt
>>> x=0; while True: print(x)
  File "<stdin>", line 1
    x=0; while True: print(x)
             ^
SyntaxError: invalid syntax
>>> _

Notice the second attempt above as a 1 liner...
Yeah I know the assignment is not a statement, but neither are they in bash, but this is easy in the shell...
Miss out the assignment and put it on a separate line and it will run...
Code:
Last login: Tue Jun 30 15:55:49 on ttys000
AMIGA:barrywalker~> python3.4
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 00:54:21) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> x=0
>>> while True: print(x)
... 
0
0
0
0
.
.
0
0
^C0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyboardInterrupt
>>> _

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Exec. commands in python

How would i do if i'd want to execute a command in a python script or programme ? (1 Reply)
Discussion started by: J.P
1 Replies

2. Red Hat

Writing simple python setup commands

Building software in most languages is a pain. Remember ant build.xml, maven2 pom files, and multi-level makefiles? Python has a simple solution for building modules, applications, and extensions called distutils. Disutils comes as part of the Python distribution so there are no other packages... (0 Replies)
Discussion started by: Linux Bot
0 Replies

3. Shell Programming and Scripting

a tip in python commands >> and <<

q = ((i + 2) * 6) >> 3 what's the meaning in python? (3 Replies)
Discussion started by: kazikamuntu
3 Replies

4. Shell Programming and Scripting

combing two lines

Hi list, I have to combine two lines and adding the " - " in between. So: Here's sentence A Here's Senctence B Here's sentence A - Here's Senctence B I know how to us SED: sed '$!N;s/\n/ /' for combining tow lines. But how do I insert the " - " correctly? Thanks! Martijn (os... (4 Replies)
Discussion started by: M474746
4 Replies

5. Shell Programming and Scripting

[Solved] How to create a script by combing two files?

I am trying to generate a csv file for utilization of each project directory. there are 10 filesystem and for each filesystem there are 16 directory. i was trying to create a script so i created two file. one is filesystem and one is project. so file looks like cat filesystems /app1 /app2... (10 Replies)
Discussion started by: anshu ranjan
10 Replies

6. Shell Programming and Scripting

How to combing output of cut commands with a delimiter?

While looping through a file, I am cutting different length of characters (based on their length) like columns and want to produce the output in a separate file with different columns being separated by a comma. How to achieve this with an online command. I don't want to create multiple variables... (8 Replies)
Discussion started by: mady135
8 Replies

7. Shell Programming and Scripting

**python** unable to read the background color in python

I am working on requirement on spreadsheet in python scripting. I have a spreadsheet containing cell values and with background color. I am able to read the value value but unable to get the background color of that particular cell. Actually my requirement is to read the cell value along... (1 Reply)
Discussion started by: giridhar276
1 Replies

8. Windows & DOS: Issues & Discussions

How to execute python script on remote with python way..?

Hi all, I am trying to run below python code for connecting remote windows machine from unix to run an python file exist on that remote windows machine.. Below is the code I am trying: #!/usr/bin/env python import wmi c = wmi.WMI("xxxxx", user="xxxx", password="xxxxxxx")... (1 Reply)
Discussion started by: onenessboy
1 Replies

9. Programming

Create a C source and compile inside Python 1.4.0 to 3.7.0 in Python for ALL? platforms...

Hi all... As you know I like making code backwards compatible for as many platforms as possible. This Python script was in fact dedicated for the AMIGA A1200 using Pythons 1.4.0, 1.5.2, 1.6.0, 2.0.1, and 2.4.6 as that is all we have for varying levels of upgrades from a HDD and 4MB FastRam... (1 Reply)
Discussion started by: wisecracker
1 Replies
TRACEBACK(1)							   User Commands						      TRACEBACK(1)

NAME
Traceback - sends an OSC message SYNOPSIS
osc-send [options] [url] osc-address [,typetags] [osc arguments] DESCRIPTION
Traceback (most recent call last): File "./scripts/osc-send", line 11, in <module> import txosc # for __version__ ImportError: No module named txosc File "./scripts/osc-send", line 11, in <module> import txosc # for __version__ ImportError: No module named txosc EXAMPLES
The following examples are equivalent: osc-send osc.tcp://127.0.0.1:17779 /ham/spam ,sif egg 2 3.14159 osc-send --tcp --host=127.0.0.1 --port=17779 --type-tags=sif /ham/spam egg 2 3.14159 osc-send -T -P 17779 /ham/spam egg 2 3.14159 OSC MESSAGES
An OSC message consists of an OSC Address Pattern followed by an OSC Type Tag String followed by zero or more OSC Arguments. OSC ADDRESSES
An OSC Address Pattern is a string beginning with the character '/' (forward slash). It is mandatory to provide one. OSC TYPE TAGS
An OSC Type Tag String is a string (beginning with the character ',' (comma)) followed by a sequence of characters corresponding exactly to the sequence of OSC Arguments in the given message. Each character after the comma is called an OSC Type Tag and represents the type of the corresponding OSC Argument. Here is the list of supported type tags: i - 32bit integer h - 64bit integer f - 32bit floating point number d - 64bit (double) floating point number s - string S - symbol c - char m - 4 byte midi packet (8 digits hexadecimal) T - TRUE F - FALSE N - NIL I - INFINITUM VALUES
Values are space separated. Quoting strings might be handy. The full Open Sound Control specification can be found at http://opensoundcontrol.org/specification HISTORY
Written by Arjan Scherpenisse and Alexandre Quessy in 2010. Traceback (most recent call last): October 2010 TRACEBACK(1)
All times are GMT -4. The time now is 07:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy