how to disable WORD WRAP in python IDLE [closed] - python

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I’m trying to print a string that is too long to be displayed on one line, so it automatically wraps to the next line. The problem is that I need it to all stay on one line and just go off the screen (where I can just scroll left to right to see it all).Is there a way to to disable word wrap in python IDLE
by changing somethings in configure option

Text wrapping is a function of your terminal, not python. All that python does is send a string to the terminal - think about it, when you say print "abcdef\n", there's no character in there that tells the terminal to wrap-text!
You just need to configure the environment you're coding in. There should be a pretty easily accessible 'settings' option. However, if you can't find it, then tell us what environment you're using - we might be able to help.

Related

How to have a % in a python statement without using two % [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
so my python application opens a link that would be found in my config file. I would like to make it so it would like to allow it to go to the website without doubling the %. Heres what I would want config.get('CONFIG', 'Website') the web address has a bunch of %'s in the link but when I run it, the process ends
I'm assuming you are using the configparser module?
If so, you can use ConfigParser(interpolation=None) to disable string interpolation (which controls the behavior of % characters in the config file).
(Or on older versions of Python, you may need to use RawConfigParser instead.)

Exiting python causes unusual bash behaviour [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I changed my shell from tcsh to bash, but i observe a strange behavior when using python interactively.
When i exit python using quit() or exit() or ctrl+D bash starts behaving like this, that is everytime i hit enter with no commands no newline is added and if i try to type anything, nothing actually is written, but somehow it is recorded and when i press enter it is executed if it is recognized as a legitimate command, othewise a command not found error appears, like this.
Using a reset on the shell brings everything back to normal. New shells behave normally.
I really don't know what could be causing this, can someone please help me?
PS: please ask if it is not clear enough.
EDIT - Result of env:
TERM_PROGRAM=Apple_Terminal
SHELL=/bin/bash
TERM=xterm-256color
TMPDIR=/var/folders/6s/ff31kwgj13s7ftrr_jdy06tc0000gq/T/
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.rPKPaf8CHZ/Render
TERM_PROGRAM_VERSION=361.1
TERM_SESSION_ID=3973FE8A-ABFF-455D-8278-E43CFC75A7D3
USER=mazzalex02
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.ZBZiVF7Brq/Listeners
__CF_USER_TEXT_ENCODING=0x1F7:0x0:0x4
PATH=/opt/local/bin:/opt/local/sbin:/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin:/opt/local/lib/pgsql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/Library/TeX/texbin
PWD=/Users/mazzalex02
DBUS_LAUNCHD_SESSION_BUS_SOCKET=/private/tmp/com.apple.launchd.HDW6moBcXw/unix_domain_listener
LANG=it_IT.UTF-8
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
SHLVL=1
HOME=/Users/mazzalex02
LOGNAME=mazzalex02
DISPLAY=/private/tmp/com.apple.launchd.sgSgWxHdhI/org.macports:0
_=/usr/bin/env
OLDPWD=/Users/mazzalex02
EDIT2 - This does not happen using python in /usr/bin/

iPython notebook not loading [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
So my iPython notebook comes up in my browser (chrome) and when I open my specific notebook a new tab opens. However the work does not load up! The page also freezes. Is this an iPython issue or something wrong with the file? Was working yesterday. I've restared comp etc. but no luck
Update: just tried renaming notebook to open again with no luck
Update 2: One has now shown up - but can't do anything with it! Is iPython simply extremely extremely slow...
Is it possible that one of the cells got a lot of output data?
if so,
try editing the file manually (with notepad++ or something like this), and delete cell's output

How to write Objective-c code in python [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to write equivalent Python code of following Objective-C code using PyObjC. Not sure how to do? Any help would be highly appreciated on ow to bridge Objective-C code into Python.
#import <IOKit/pwr_mgt/IOPMLib.h>
...
// kIOPMAssertionTypeNoDisplaySleep prevents display sleep,
// kIOPMAssertionTypeNoIdleSleep prevents idle sleep
//reasonForActivity is a descriptive string used by the system whenever it needs
// to tell the user why the system is not sleeping. For example,
// "Mail Compacting Mailboxes" would be a useful string.
// NOTE: IOPMAssertionCreateWithName limits the string to 128 characters.
CFStringRef* reasonForActivity= CFSTR("Describe Activity Type");
IOPMAssertionID assertionID;
IOReturn success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep,
kIOPMAssertionLevelOn, reasonForActivity, &assertionID);
if (success == kIOReturnSuccess)
{
//Add the work you need to do without
// the system sleeping here.
success = IOPMAssertionRelease(assertionID);
//The system will be able to sleep again.
}
...
you need to generate a bridge file for the IOKit.framework first using the gen_bridge_metadata command.
you can hard code the contents of the file into a Python variable if you want.
then load the bridge into into PyObjC using objc.parseBridgeSupport()
objc.parseBridgeSupport(BRIDGE_FILE_STRING, globals(), objc.pathForFramework("/System/Library/Frameworks/IOKit.framework"))`
examples here and here
Here is an example that does almost exactly what you are asking.

Recognising # symbol within Python Code as Code Not Comment [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I am currently putting some code together to create a TCP/IP client which will have to communicate with an existing network server (Local not Internet). The server code is out of my control as it is already in place. I seem to have test code that works, at least the server recognises that a client with the relevant IP address is making a connection, however, on first connection the server sends out an Identify command to confirm the client is valid:
IDENTIFY_#
This is my problem. The client code has to be written in Python and obviously #'s seem to create an issue. My understanding (being new to Python) is that they are only used for comments and all of the posts and books I have read seem to say the same. Unfortunately I have to respond with strings that also possess #'s as termination characters for data sets so it makes things twice as problematic. Is it possible to get Python to recognise a # for what it is and not throw a wobbly because it assumes it is a comment?
If the # symbol is within a string literal, it shouldn't be interpreted as a comment.

Categories

Resources