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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:38:58+00:00 2026-06-09T19:38:58+00:00

I need to convert .ass subtitles file into .xml file. So far I did

  • 0

I need to convert .ass subtitles file into .xml file. So far I did it by hand, but I have to do more and more of it.

That’s how process looks like:

Input .ass file:

Dialogue: 0,0:00:08.03,0:00:10.57,Default,,0000,0000,0000,,Actor says something
Dialogue: 0,0:00:11.28,0:00:21.05,Default,,0000,0000,0000,,Actor says something
etc.

Output .xml file:

<p begin="00:00:08.03" end="00:00:10.57">Actor says something</p>
<p begin="00:00:11.28" end="00:00:21.05">Actor says something</p>
etc.

I dodn’t know how to solve this task.

  • 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-06-09T19:38:59+00:00Added an answer on June 9, 2026 at 7:38 pm

    First, you should extract the relevant information from your source file. As the data is ,-seperated, you can use the python csv module or do a simple split(',').

    This is an example method of how it could look like:

    def extract(source):
        for line in iter(source):
            _, start, end, _, _, _, _, _, _, text = line.strip().split(',', 9)
            yield start, end, text
    

    The next step if to convert your extracted data to the desired xml format. A function that plays well with the data from the first method could look like this (using simple string formatting):

    xml = '<p begin="{start}" end="{end}">{text}</p>'
    def to_xml(start, end, text):
        return xml.format(start=start, end=end, text=text)
    

    Finally, opening the files and use the methods to write your output:

    with open('input.ass') as infile, open('output.xml', 'w') as outfile:
        for start, end, text in extract(infile):
            outfile.write(to_xml(start, end, text) + '\n')
    

    While you could of course make this smaller (less LOC), it is a readable approach IMHO.

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

Sidebar

Related Questions

need to convert an xml file having a tag(dynamicVariable) that has an attribute(name).This xml
I need to convert the video into png images. I did that using ffmepg.
I need to convert a specific part of an XML file to string, with
i need to convert this query to C# LINQ but i have no idea
I need convert a String to a decimal in C#, but this string have
I need to convert date/time in a text file into number of minutes elapsed
I have a string and need convert it to a date, but it doesn't
I need to convert HTML documents into valid XML, preferably XHTML. What's the best
Need to convert some XML I'm receiving into HTML quickly. Do I need to
I need to convert a time difference (diff) between two actions into a human

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.