All Questions
5 questions
0
votes
0
answers
48
views
str.readline() with colored standard output catch startswith()
I need to parse a logfile that prints colored output in this format:
<0x1b[32sometexthere[0m
I'm reading the logfile in with:
line = logfile.readline()
and then I want to get it if it starts ...
0
votes
1
answer
1k
views
TypeError: can only concatenate str (not "bytes") to str Python3.6.8
My script I got from the web
#! /usr/bin/python
print ("\n*********************************************************************")
print ("Cisco IOU License Generator - Kal 2011, python port of 2006 C ...
0
votes
2
answers
59
views
Use python string as byte
I have the byte representation of a character in a string, let's say the character is 'H', which has the byte value of 72. My string is therefore "72".
How do I go about converting this string ("72") ...
4
votes
2
answers
3k
views
Getting rid of the 'b' in front of Python strings [duplicate]
EDIT: To save people the trouble of scrolling, the problem stemmed from the "decode" operation needing an output variable; my script failed to do this. I thought that the "for" loop would modify the ...
0
votes
0
answers
277
views
TypeError: a bytes-like object is required, not 'str' (file opening)
I've been unsuccessful with adding a "b" for byte-reading infront of all the strings, even though it should solve the problem according to lots of older threads.
Here's my code:
# -*- coding: utf-8 -*...