[Solved] how to remove [ , ] and single quote in class list in python 3 in single line of code? [closed]

Based on your update on what bid_data contains: Do: int(bid_data[6].split(‘:’)[1].strip()) # returns an integer Explanation: The Python string method strip() removes excess whitespace from both ends of a string (without arguments) Original below: Below is based on using the input you gave, [‘Quantity Required’, ‘ 1’], to get the output of 1 If the input … Read more

[Solved] Dividing one column into two columns in SQL [duplicate]

try this: DECLARE @YourTable table (Column1 varchar(50)) INSERT @YourTable VALUES (‘Frodo Baggins’) INSERT @YourTable VALUES (‘Samwise Gamgee’) INSERT @YourTable VALUES (‘Peregrin Took’) INSERT @YourTable VALUES (‘Meriadoc Brandybuck’) INSERT @YourTable VALUES (‘aa’) INSERT @YourTable VALUES (‘aa bb cc’) SELECT LEFT(Column1,CHARINDEX(‘ ‘,Column1)) AS Names ,RIGHT(Column1,LEN(Column1)-CHARINDEX(‘ ‘,Column1)) AS Surnames FROM @YourTable –both queries produce same output SELECT SUBSTRING(Column1, … Read more

[Solved] Parts of string in regex

This should get you started: var myUrl = “wmq://aster-C1.it.google.net@EO_B2:1427/QM.0021?queue=SOMEQueue?”; var myRegex = new Regex(@”wmq://(.*?)@(.*?)\?queue=(.*?)\?”); var myMatches = myRegex.Match(myUrl); Debug.Print(myMatches.Groups[1].Value); Debug.Print(myMatches.Groups[2].Value); Debug.Print(myMatches.Groups[3].Value); But you may need to change it a bit for variations in the url. There are proper tutorials on the web to explain Regex, but here is some quick info: @ before a string … Read more

[Solved] Splitting line on python

Let us say you have splitted_result = [‘/media/My’, ‘Passport/fileName1’] Then you can do a simple join >>> [‘ ‘.join(splitted_result)] [‘/media/My Passport/fileName1’] This will output a list as its result. solved Splitting line on python

[Solved] Python – Read and split every “:” and add into value

The string ‘split’ function takes a seprarator as an argument (https://docs.python.org/2/library/stdtypes.html#str.split). You might want to call the function like this: value = “hello:world:how:are:you”.split(“:”) And it will give you a list of items: [‘hello’,’world’,’how’,’are’,’you’] You can access them by simply using their index like this: value[0] # is ‘hello’ value[1] # is ‘world’ and so on. … Read more

[Solved] c# split and then make math operation [closed]

Try this: var data = File .ReadAllLines(@”@”C:\..\..\..\..\..\..\..\ex1.txt””) .Select(line => line.Split(‘,’)) .Select(parts => new { city = parts[0], temperature = decimal.Parse(parts[1].Trim()) }) .ToArray(); Array.ForEach(data, item => Console.WriteLine(item.city)); Console.WriteLine(data.Average(item => item.temperature)); I get this: Londres Berlin New York Tokyo 11.25 solved c# split and then make math operation [closed]

[Solved] Splitting multiple columns data into rows

Try this code (comments in code): Sub Expand() Dim currentRow As Long, lastRow As Long, table As Variant, i As Long, _ valuesInOneRowCol1 As Variant, valuesInOneRowCol2 As Variant, valuesInOneRowCol3 As Variant lastRow = Cells(Rows.Count, 1).End(xlUp).Row currentRow = 2 ‘read hwole range to memory and clear the range to fill it with expanded data table = … Read more

[Solved] Split and cut string in C# [closed]

Your string looks like it’s being broken down by sections that are separated by a ,, so the first thing I’d do is break it down into those sections string[] sections = str.Split(‘,’); IT looks like those sections are broken down into a parameter name, and a parameter value, which are seperated by :. so … Read more

[Solved] How to split a string by white spaces in C# [closed]

The data is fixed width columns so use following : using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Data; namespace ConsoleApplication1 { class Program { const string FILENAME = @”c:\temp\test.txt”; static void Main(string[] args) { FIX_WIDTH fixWidth = new FIX_WIDTH(FILENAME); } } public class FIX_WIDTH { int[] Start_Position = { 0, 55, … Read more

[Solved] count total in a list python by split

That’s not a list. You are using a dictionary with key and value. Get the value, split on comma and find length using len. workdays = {‘work’: ‘5,6,8,10,13,14,15,18,20,22,24,25,28,30’} print(‘I have worked {} days’.format(len(workdays[‘work’].split(‘,’)))) Also, you could count the number of commas and add 1 to it to get the same result like so: print(‘I have … Read more

[Solved] Split EDI string on ‘ in c#

Looking at your input and expected output there is a space that has gone missing. If you really want to remove that space you could use LINQs Select extension method: var orderElements = order.Split(‘\”).Select(s => s.Trim()).ToList(); Also the string ends in an ‘ so you might want to remove empty entries like: .Split(new char[] { … Read more