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 6870595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:42:09+00:00 2026-05-27T03:42:09+00:00

in views: ‘some_array’: [‘text1′,’text2’, ‘text3’] When I try to transfer it in template to

  • 0

in views:

'some_array': ['text1','text2', 'text3']

When I try to transfer it in template to js script:

<script type="text/javascript">
    some_func({{ some_array }});
</script>

In source code it looks like:

<script type="text/javascript">
    some_func([u'text1', u'text2', u'text3']);
</script>

So it is an error in javascript.

How to remove prefix u'' from array’s elements or how to get around this?

Thanks!

  • 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-27T03:42:10+00:00Added an answer on May 27, 2026 at 3:42 am

    When you transfer a Python list into a string, you are creating the Python representation of your variable (__repr__). What you are trying to do here is create a JavaScript representation of the same data.

    JSON is a great way to transfer data because so many languages have good JSON parsers. In the case of JavaScript this is even more true since JSON is actually native JavaScript syntax so you can put the JSON representation straight into the JavaScript source.

    To generate the JSON, you can use Python’s built-in JSON library (Python 2.6+).

    >>> import json
    >>> json.dumps([u'text1', u'text2', u'text3'])
    '["text1", "text2", "text3"]'
    

    This creates a string that can be used in your template.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've used the Views Theming Wizard to output a template and it gave me
in views.py I have this: def logout(request,key): auth.logout(request) return HttpResponseRedirect(reverse('airAgency.views.index',args=[key])) in index template i
I have two views with navigation controller: first view, there are empty text fields
In my views I'm using a generic type for the Model, ItemModel<T> . This
I want to add views on click of button. My screen has a text
Instead of going to views.py, I want it to go to to a template,
Views contextual filter 'Content: Has taxonomy term ID' work perfectly, when I try to
In views: model = Model('some_title', 'some text') session.add(model) return HTTPFound(location='/ads/%s/%s' % (model.id, model.title)) So,
I have two views. The User view has some text and a button. I
My Views dataContext is bounded to a presentationModel with two observableCollections Members. In 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.