Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6103233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:42:20+00:00 2026-05-23T13:42:20+00:00

I am writing a program in python and have some question (I am 100%

  • 0

I am writing a program in python and have some question (I am 100% new to python):

import re

rawData = '7I+8I-7I-9I-8I-'

print len(rawData)

rawData = re.sub("[0-9]I\+","",rawData)
rawData = re.sub("[0-9]I\-","",rawData)

print rawData
  1. How to merge the 2 regex into one using |? It means it will get rid of both 9I- and 9I+ using just one regex operation.
  2. Does len(rawData) return the length of rawData is byte?

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:42:21+00:00Added an answer on May 23, 2026 at 1:42 pm

    See the difference:

    $ python3
    Python 3.1.3 (r313:86834, May 20 2011, 06:10:42) 
    [GCC 4.4.5] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> len('día')   # Unicode text
    3
    >>> 
    
    $ python
    Python 2.7.1 (r271:86832, May 20 2011, 17:19:04) 
    [GCC 4.4.5] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> len('día')   # bytes
    4
    >>> len(u'día')  # Unicode text
    3
    >>>
    
    
    Python 3.1.3 (r313:86834, May 20 2011, 06:10:42) 
    [GCC 4.4.5] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> len(b'día')
      File "<stdin>", line 1
    SyntaxError: bytes can only contain ASCII literal characters.
    >>> len(b'dia')
    3
    >>> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just as the title goes. I have a python program which processes some data
I am currently writing a non-web program using mostly python and have gotten to
I am writing a program in Python that will act as a server and
I am writing a program in Python, and I realized that a problem I
Writing a python program, and I came up with this error while using the
I'm writing a Python program with a lot of file access. It's running surprisingly
I am writing a python program that lauches a subprocess (using Popen). I am
I'm writing a python program. The program calculates Latin Squares using two numbers the
In the python program I'm writing, I've got a thread which iterates over a
Im writing a program that should read input via stdin, so I have the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.